Skip to main content

arr[]

arr[index]

Retrieves the index-th element in arr. The first element is arr[0], the second element is arr[1], and so on.

Input:
index : integer
Position of desired element to retrieve in array.
Returns:
The element at the specified index of the array
Return Type:
integer, float, string, list, etc.

weight_ser = pets.get('Weight')
weight_ser
  • dog_00140
  • cat_00115
  • cat_00220
  • dog_00280
  • dog_00325
  • ham_0011
  • ham_0020.25
weight_arr = np.array(weight_ser)
weight_arr

array([40. , 15. , 20. , 80. , 25. , 1. , 0.25])

weight_arr[2]

20.0